<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>

      <input type="text" name="studentId" id="studentId" />
      <input type="text" name="studentName" id="studentName" />
      <input type="submit" value="提交" id="submit" />

  </body>
  <script src="./js/jquery-3.6.3.min.js"></script>
  <script>
    $("#submit").click(function () {
      //获取学生id
      let studentId = $("#studentId").val();
      //获取学生name
      let studentName = $("#studentName").val();
      //构造成一个JS对象
      let postDate = {
        "studentId": studentId,
        "studentName": studentName
      };

      //发送Ajax请求
      $.ajax({
        type: "post",
        url: "jackson",
        contentType: "application/json",
        data: JSON.stringify(postDate),
        success: function (data) {
          console.log(data);
        }
      });
    });
  </script>
</html>
